package org.nepu.srr.设备设施资料.救生设备证书;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.CommonIn;
import org.nepu.sc.domain.CommonMethods;

@Data
public class B48LiveParams {
    @ApiModelProperty("救生艇、吊艇架、吊钩")
    CommonIn lifesavingEquipment;

    @ApiModelProperty("救生筏")
    CommonIn lifesavingCanoe;

    @ApiModelProperty("静水压力释放器")
    CommonIn pressureReleaseDevice;

    @ApiModelProperty("救生圈")
    CommonIn lifesavingCircle;

    @ApiModelProperty("救生衣")
    CommonIn lifesavingClothing;

    @ApiModelProperty("烟雾信号")
    CommonIn smogSignal;

    @ApiModelProperty("示位标")
    CommonIn flagPole;

    @ApiModelProperty("自亮浮灯")
    CommonIn selfIlluminationLamp;

    @ApiModelProperty("救生软梯")
    CommonIn lifesavingStair;

    @ApiModelProperty("救生艇空气瓶")
    CommonIn lifesavingTank;

    @ApiModelProperty("抛绳器")
    CommonIn throwRings;

    public  B48LiveResult rate(){
        double fullScore = 110;
        double score = 0;
        if(CommonMethods.isAllTrue(lifesavingEquipment.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(lifesavingCanoe.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(pressureReleaseDevice.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(lifesavingCircle.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(lifesavingClothing.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(smogSignal.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(flagPole.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(selfIlluminationLamp.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(lifesavingStair.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(lifesavingTank.getInput())){
            score += 10;
        }
        if(CommonMethods.isAllTrue(throwRings.getInput())){
            score += 10;
        }
        double rate = score/fullScore;
        B48LiveResult result = new B48LiveResult();
        result.setRateScore(rate);
        String s = CommonMethods.toGrade(rate);
        result.setRateResult(s);
        return result;    }
}
